// components/courseTeacher/courseTeacher.js
Component({

  /**
   * 组件的属性列表
   */
  properties: {
    course:{
      type:Object
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

    id:0,
    consultant:{}
  },

  /**
   * 组件的方法列表
   */
  methods: {
    enterConsultDetail(event){
      const consultantId = this.data.consultant.consultantId;
       if (consultantId) { 
         wx.navigateTo({ url: `/pages/consult_detail/person/person?id=${this.data.consultant.consultantId}` }); 
        }
        else { console.error("Consultant ID is not available for navigation."); }
    },
    entercertificate:function(e){
      wx.navigateTo({
        url: `/pages/consult_detail/consultantcertificate/consultantcertificate?id=${this.data.consultant.consultantId}`,
      })
    },

    
  },
  attached(){
    this.setData({
      id:this.data.course.consultant.consultantId
    })
    wx.request({
      url: 'http://localhost:8085/consultant/findConsultantById?id='+this.data.id,
      method:"GET",
      success:(res)=>{
        console.log(res.data.data)
        this.setData({
          consultant:res.data.data
        })
      },
      fail:(err)=>console.log(err)
    })
  },
  
})